package com.qf.lanzhou.shop.api.controller;

import com.qf.lanzhou.shop.api.service.GoodsService;
import com.qf.lanzhou.shop.pojo.entity.Goods;
import com.qf.lanzhou.shop.pojo.vo.BaseRespVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author Yeach-chen
 * @ClassName GoodListController
 */
@Controller
@Api(tags = "主页商品接口")
public class GoodListController extends BaseController {
    @Autowired
    private GoodsService goodsService;

    @ApiOperation(value = "获取商品接口")
    @RequestMapping("/get_goods")
    @ResponseBody
    public BaseRespVO getGoosList() {
        List<Goods> goodsList = goodsService.getGoodsList();
        return convertSuccessResult(goodsList);
    }

    @ApiOperation(value = "获取抢购商品接口")
    @RequestMapping("/get_snapup_goods")
    @ResponseBody
    public BaseRespVO getSnapUpGoods() {
        Goods snapUpGoods = goodsService.getSnapUpGoods();
        return convertSuccessResult(snapUpGoods);
    }
    @ApiOperation(value = "获取畅销商品接口")
    @RequestMapping("/get_bestsellinggoods")
    @ResponseBody
    public BaseRespVO getBestSellingGoods() {
        List<Goods> bestSellingGoods = goodsService.getBestSellingGoods();
        return convertSuccessResult(bestSellingGoods);
    }
    @ApiOperation(value = "获取折扣商品接口")
    @RequestMapping("/get_discountgoods")
    @ResponseBody
    public BaseRespVO getDiscountGoods() {
        List<Goods> discountGoods = goodsService.getDiscountGoods();
        return convertSuccessResult(discountGoods);
    }
}
